/*
 * Copyright (c) 2017,重庆阿莫比科技有限公司,All Rights Reserved.
 */
package com.wowocai.btchina.filter;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
 * <br/>
 * Date: 2017年3月3日 下午4:25:16 <br/>
 * 
 * @Author 刘建成
 * @Version
 */
public class GzipRequestWrapper extends HttpServletRequestWrapper {


    private ServletInputStream is;
    private BufferedReader reader;

    public GzipRequestWrapper(HttpServletRequest request) throws IOException {
      super(request);
      this.is = new GzipRequestStream(request);
      this.reader = new BufferedReader(new InputStreamReader(this.is));
    }

    @Override
    public ServletInputStream getInputStream() throws IOException {
      return is;
    }

    @Override
    public BufferedReader getReader() throws IOException {
      return reader;
    }
}
